ds_grid_get


描述

This function can be used to get the value (either a real number or a string) from any cell within the given ds_grid. If you pass invalid grid coordinates to the function, then the value returned will be 0.


语法:

ds_grid_get(index, x, y);

参数 描述
index 栅格的索引
x The x position of the cell you want to find the value of.
y The y position of the cell you want to find the value of.


返回:

Real or String


例如:

var xx, yy;
xx = irandom(ds_grid_width(grid) - 1);
yy = irandom(ds_grid_height(grid) - 1);
val = ds_grid_get(grid, xx, yy)

The above code selects a random cell from the ds_grid indexed in the variable "grid" and stores its value in the variable "val".